package old.coordinate;

import galaxies.models.MGalaxy;
import gameAppLayer.GameSettings;

import java.util.ArrayList;
import java.util.HashSet;

import utilities.Key;

import com.jme3.asset.AssetManager;
import com.jme3.math.Vector3f;

import controller.AbstractController;

/*
 * Creates models, views, and controllers for extra-galactic coordinates
 * Inputs:  ArrayList<Vector3f> of locations
 * Outputs:  ArrayList<Controller> or Controller for objects at each coordinate
 */
public class CoordinateGenerator {
	
	private CoordinateModel tempModel;
	private CoordinateView tempView;
	private CoordinateController tempController;
	private ArrayList<CoordinateController> coordinateControllers = new ArrayList<CoordinateController>();
	
	private CoordinateModelBuilder modelFact;
	private CoordinateViewBuilder viewFact;
	
	GameSettings settings;
	AssetManager assets;
	
	public CoordinateGenerator(GameSettings settings, AssetManager assets) {
		this.settings = settings;
		this.assets = assets;
	}
	
	public CoordinateController createIndependentCoord(Vector3f location) {
		//FMCoordinate fact = new FMCoordinate();
		
		tempModel = modelFact.createCoordinate(location);
		
		tempController = new CoordinateController();
		tempController.setModel(tempModel);
		
		tempView = viewFact.createView(tempModel, assets);
		tempView.setController(tempController);
		
		return tempController;		
	}
	
	public ArrayList<CoordinateController> createIndependentCoords(ArrayList<Vector3f> locations) {
		
		for (Vector3f vector: locations) {
			coordinateControllers.add(createIndependentCoord(vector));
		}
		
		return coordinateControllers;		
	}

}
